Node.JS isDeepStrictEqual

Chat GPT 4o answer

Here’s a quick evaluation based on your context:


util.isDeepStrictEqual(lhs, rhs)

Pros


⚠️ Considerations


In Your Case (e.g., VO.equals)

Since your DayAvailability#equals() is already tailored (e.g., handling only first 144 bits of Uint32Array, ignoring unused bits, comparing a Map<number, string>), isDeepStrictEqual would not be a suitable drop-in replacement.

However, for comparing plain objects like:

const a = { h: 0, m: 10 };
const b = { h: 0, m: 10 };

import { isDeepStrictEqual } from 'node:util';
console.log(isDeepStrictEqual(a, b)); // ✅ true

…it works perfectly.


✅ When to use

isDeepStrictEqual


❌ When not to use


🔧 Alternative for browser

If you’re working in a shared environment (browser + Node), consider:

npm install fast-deep-equal
import deepEqual from 'fast-deep-equal';

deepEqual(a, b);

Let me know if you want to benchmark isDeepStrictEqual or wrap it for optional shallow/deep toggles.